package com.onlinesys.action;

import java.util.List;

import com.onlinesys.beans.LeftMenu;
import com.onlinesys.beans.UserGroup;
import com.onlinesys.beans.UserInfo;
import com.onlinesys.service.LeftMenuService;
import com.onlinesys.service.UserGroupService;
import com.onlinesys.service.impl.LeftMenuServiceImpl;
import com.onlinesys.service.impl.UserGroupServiceImpl;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class LeftMenuAction extends ActionSupport {

	/**
     * 
     */
    private static final long serialVersionUID = 1L;

    List<LeftMenu> leftMenu = null;

	Long fatherModid = null;

	public String execute() throws Exception {
	    LeftMenuService lms = new LeftMenuServiceImpl();
	    UserGroupService ugs = new UserGroupServiceImpl();
	    UserInfo ui = (UserInfo)ActionContext.getContext().getSession().get("user");
	    UserGroup group = ugs.getUserGroupByUser(ui.getUserId());
	    if (group != null) {
	        leftMenu = lms.getLeftMenus(group.getModules());
	    }
		return SUCCESS;
	}

	public List<LeftMenu> getLeftMenu() {
		return leftMenu;
	}

	public void setLeftMenu(List<LeftMenu> leftMenu) {
		this.leftMenu = leftMenu;
	}

	public Long getFatherModid() {
		return fatherModid;
	}

	public void setFatherModid(Long fatherModid) {
		this.fatherModid = fatherModid;
	}

}
